# -*- coding: UTF-8 -*-

import requests
import time

def output(num,org,token):
    url = "https://api.gitcode.com/api/v5/orgs/" + org + "/repos?access_token=" + token + "&page=" + num + "&per_page=100"
    payload = {}
    headers = {
      'Accept': 'application/json'
    }

    response = requests.request("GET", url, headers=headers, data=payload)
    current_page_repos = response.json()
    for idx, repo in enumerate(current_page_repos, 1):
        print(f"{repo['name']}")
        #print(f"{idx}.{repo['name']}")

access_token = ""#写入个人令牌
org_name = ""#写入项目名称
repos = ""#仓库数量
for i in range(repos//100 + 1):
    output(str(i+1), org_name, access_token)
    time.sleep(1)
